﻿using System.Collections.ObjectModel;
using System.Windows.Input;

using Outcoder;
using Outcoder.UI.Xaml;

namespace CalciumTemplateApp.Views
{
    public class MainViewModel : ViewModel
    {
		public MainViewModel() : base(() => AppResources.Views_Main_Title)
	    {
			navigateToHubCommand = new UICommand(NavigateToHub)
				{
					Text = AppResources.MainView_AppBar_Buttons_Hub,
					IconUrl = "/Views/MainView/Images/AppBar/Settings.png"
				};
			
			appBarButtonCommands.Add(navigateToHubCommand);

		    var menuCommand = new UICommand(_ => DialogService.ShowMessageAsync("Menu Item 1 tapped.")) { Text = "Menu Item 1"};
			appBarMenuCommands.Add(menuCommand);

			menuCommand = new UICommand(_ => DialogService.ShowMessageAsync("Menu Item 2 tapped.")) { Text = "Menu Item 2" };
			appBarMenuCommands.Add(menuCommand);
	    }

	    readonly UICommand navigateToHubCommand;

	    public ICommand NavigateToHubCommand
	    {
		    get
		    {
			    return navigateToHubCommand;
		    }
	    }

	    void NavigateToHub(object arg)
	    {
		    var hubView = Dependency.Resolve<HubView>();
		    Navigation.PushAsync(hubView);
	    }

		readonly ObservableCollection<IUICommand> appBarButtonCommands 
						= new ObservableCollection<IUICommand>();

		public ObservableCollection<IUICommand> AppBarButtonCommands
	    {
		    get
		    {
			    return appBarButtonCommands;
		    }
	    }

		readonly ObservableCollection<IUICommand> appBarMenuCommands 
						= new ObservableCollection<IUICommand>();

		public ObservableCollection<IUICommand> AppBarMenuCommands
		{
			get
			{
				return appBarMenuCommands;
			}
		}
    }
}
